package cc.magicjson.example.demo.task.optional;

public class LLFStrategy implements SchedulingStrategy {

    @Override
    public int compare(PriorityScheduledTask t1, PriorityScheduledTask t2) {
        long laxity1 = t1.getDeadline() - (System.currentTimeMillis() - t1.getCreationTime());
        long laxity2 = t2.getDeadline() - (System.currentTimeMillis() - t2.getCreationTime());
        return Long.compare(laxity1, laxity2);
    }
}